package com.szholly.data.general;

/**
 * 类功能说明 关联关系类型
 */
public enum RelationType {
	/**
	 * 一对一
	 */
	OneToOne(0),

	/**
	 * 一对多
	 */
	OneToMore(1),	
	/**
	 * 多对多
	 */
	MoreToMore(2);

	private final int relationType;

	public int getRelationType() {
		return relationType;
	}

	private RelationType(int relationType) {
		this.relationType = relationType;
	}

	// 通过tableTypeID返回 TableType
	public static RelationType getTableTypeByTypeId(int relationTypeId) {
		for (RelationType relationType : values()) {
			if (relationType.getRelationType() == relationTypeId) {
				return relationType;
			}
		}
		return null;
	}

	public static void main(String[] args) {
		System.out.println(RelationType.values());
	}

}
